﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace LanZhouBeefNoodles.Models
{
    /// <summary>
    /// 客户评价仓储实现（假数据）
    /// </summary>
    public class MockFeedbackRepository : IFeedbackRepository
    {
        private List<Feedback> m_feedbacks;

        public MockFeedbackRepository()
        {
            if (m_feedbacks == null || m_feedbacks.Count == 0)
            {
                InitializeFeedback();
            }
        }

        private void InitializeFeedback()
        {
            m_feedbacks = new List<Feedback>()
            {
                new Feedback{Id=1,Name="张三",Email="zhangsan@mail.com",CreateDateUTC=DateTime.Now,Message="非常棒"},
                new Feedback{Id=2,Name="李四",Email="lisi@mail.com",CreateDateUTC=DateTime.Now,Message="挺好的"},
                new Feedback{Id=3,Name="王五",Email="wangwu@mail.com",CreateDateUTC=DateTime.Now,Message="一般"},
                new Feedback{Id=4,Name="赵六",Email="zhaoliu@mail.com",CreateDateUTC=DateTime.Now,Message="不好吃"}
            };
        }

        public List<Feedback> GetAllFeedbacks()
        {
            return m_feedbacks;
        }

        public void AddFeedback(Feedback feedback)
        {
            m_feedbacks.Add(feedback);
        }
    }
}
